//
//  YSStatusModel.swift
//  新浪浪
//
//  Created by mac on 16/3/2.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

class YSStatusModel: NSObject {

    
    ///  created_at	string	微博创建时间
    /// text	string	微博信息内容
    ///source	string	微博来源
    // 用户模型
    
    /*******************************************/
    /*     注意添加问号设置为可选    */
    /***************************************************/
    
    var id: Int = 0
    var created_at: String?
    var text: String?
    var source:String?
     // 用户模型
    var user:YSStatusUserModel?
    
    ///reposts_count	int	转发数
    var reposts_count: Int = 0
    ///comments_count	int	评论数
    var comments_count :Int = 0
    ///attitudes_count	int	表态数
    var attitudes_count: Int = 0
    ///retweeted_status	object	被转发的原微博信息字段，当该微博为转发微博时返回 详细
    var retweeted_status: YSStatusModel?
    var pic_urls: [YSPictureModel]?
    
    init(dic:[String:NSObject]) {
        
        super.init()
        
        setValuesForKeysWithDictionary(dic)
        
        
        if let userDic = dic["user"] as? [String:NSObject] {
            user = YSStatusUserModel (dic: userDic)
        }
        if let retweetDic = dic["retweeted_status"] as? [String:NSObject]{
            retweeted_status = YSStatusModel (dic: retweetDic)
        }
        
        if let pic_URLS = dic["pic_urls"] as? [[String:NSObject]]{
            pic_urls = [YSPictureModel]()
            for info  in pic_URLS{
                pic_urls?.append(YSPictureModel(dic: info))
            }
        }
        
        
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
}





